package com.wdb007.venus.wss.service.impl;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.wdb007.venus.wss.bootstrap.Application;
import com.wdb007.venus.wss.channelgroup.BookCaseChannelGroups;
import com.wdb007.venus.wss.channelgroup.ChannelGroups;
import com.wdb007.venus.wss.service.WebSocketServerService;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;

@Service("webSocketServerService")
public class WsServerService implements WebSocketServerService {

	private static Logger log = LoggerFactory.getLogger(Application.class);
	 
	@Override
	public String doService(ChannelHandlerContext ctx, String request) {
		Channel channel = ctx.channel();
		//应用服务器 向推送服务器发送消息
		if(ChannelGroups.contains(channel)) {
			
		}else if(BookCaseChannelGroups.contains(channel)) { //书柜向推送服务器发送消息
			
		}
		log.info("server 收到 文本消息[" + request + "]");
		
		
		return "test msg returns!req:[" + request + "]; return time[" + new Date().toString() + "]";
	}

}
